package com.jungle.sp.daily.controller;

import com.jungle.sp.daily.service.MyClient;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Jungle
 * @create 2024-06-03 19:54
 */
@Slf4j
@RequestMapping("/client")
@RestController
public class ClientController {
    // 注入自定义的 Forest 接口实例
    @Resource
    private MyClient myClient;


    @GetMapping("/tests")
    public void testClient() {
        // 调用自定义的 Forest 接口方法
        // 等价于发送 HTTP 请求，请求地址和参数即为 helloForest 方法上注解所标识的内容
        String result = myClient.helloForest();
        // result 即为 HTTP 请求响应后返回的字符串类型数据
        log.info("==>{}", result);
    }


    @GetMapping("/hello")
    public String hello() {
        log.info("==>{}", "调用成功");
        return "hello";
    }
}
